home *** CD-ROM | disk | FTP | other *** search
/ PC Open 107 / PC Open 107 CD 1.bin / CD1 / INTERNET / COPIA SITI / Getleft / getleft-setup-notcl.exe / {app} / doc / showhelp.tcl < prev    next >
Encoding:
Tcl/Tk script  |  2004-02-21  |  1.6 KB  |  64 lines

  1. #!/usr/bin/wish
  2.  
  3. proc ReadConfig {confFile } {
  4.     set handle [open $confFile]
  5.  
  6.     for {} {![eof $handle]} {} {
  7.         set line [gets $handle]
  8.         if {[regexp {^#|^ |^$} $line]} {
  9.             continue
  10.         }
  11.         if {[regexp {(?:\[)(.*)(?:\])} $line nada active]} {
  12.             continue
  13.         }
  14.         switch -regexp -- $active {
  15.             scripts {
  16.                 set helpDir $line
  17.             }
  18.         }
  19.     }
  20.     return $helpDir
  21. }
  22.  
  23.  
  24. wm withdraw .
  25. wm overrideredirect . 1
  26. set scriptDir [file dirname [info script]]
  27. if {[file exists [file join $scriptDir ../scripts/help.tcl]]} {
  28.     set helpDir [file join [file dirname [info script]] ../scripts/]
  29. } else {
  30.     if {$tcl_platform(platform)=="unix"} {
  31.         if {[file exists /etc/getlet.conf]} {
  32.             set helpDir [ReadConfig /etc/getleft.conf]
  33.         } elseif {[file exists /usr/local/etc/getleft.conf]} {
  34.             set helpDir [ReadConfig /usr/local/etc/getleft.conf]
  35.         } else {
  36.             tk_messageBox -icon error -title Error -type ok \
  37.                     -message "I can't find the help system"
  38.             exit
  39.         }
  40.     }
  41. }
  42. # We set a temp dirGetleft(icons) so we can source Ayuda.tcl
  43. if {![info exists dirGetleft(icons)]} {
  44.     set dirGetleft(images) [file join $helpDir .. images]
  45.     set dirGetleft(icons)  [file join $dirGetleft(images) Crystal]
  46. }
  47. source [file join $helpDir Ayuda.tcl]
  48. source [file join $helpDir help.tcl]
  49.  
  50. help::init [file join $scriptDir help.help] contents "" 450 525
  51.  
  52. after 1000 exit_on_destroy
  53.  
  54. proc exit_on_destroy {} {
  55.     if {[winfo exists .tophelpwindow]} {
  56.         after 1000 exit_on_destroy
  57.     } else {
  58.         exit
  59.     }
  60. }
  61.  
  62.  
  63.  
  64.